#include "utilities.h"

/* Defnition of methods for struct argand */

argand::argand(){
  real = imaginary = 0;
}

argand::argand(double x,double y){
  real = x;
  imaginary = y;
}

argand::argand(polar a){
  real = a.abs * cos(a.args);
  imaginary = a.abs * sin(a.args);
}

double argand::abs(){
  return sqrt(real*real + imaginary*imaginary);
}

double argand::arg(){
  return atan(imaginary/real);
}

argand argand::conjugate(){
  return argand(real,-imaginary);
}

polar argand::to_polar(){
  return polar(abs(),arg());
}

polar::polar(argand a){
  abs = a.abs();
  args = a.arg();
}

polar::polar(){
  abs = args = 0.0;
}

polar::polar(double a, double b){
  abs = a; args = b;
}

